<?php

require_once(dirname(__FILE__).'/class.table.php');

$table = new table('border="1"');
$table->caption('People');

# we open the head part
$table
	->part('head')
	->headers('Name', array('Age' => 'title="in years"'), 'Country');

# we open the body part, head part is closed
$table
	->part('body', 'style="color:blue;"')
	->row()
	->cells('John', 23, 'USA');

$table
	->row()
	->cell('Jack')
	->cell('42')
	->cell('Mexico')
	# add another row
	->row()
	->cell('Philip J. Fry')
	->cell('23')
	->cell('India');

# we open the tfoot part, body part is closed
$table
	->part('foot', 'style="color:Purple;"')
	->cell("Total:")
	->cell(23 + 42 + 23)
	# an empty cell
	->cell();

# we can reopen a closed part and add rows
# the extra HTML of the body is updated
$table
	->part('body', 'style="color:Green;"')
	->row()
	->cells('Igor', 43, 'Russia');

echo($table);
